package com.ss.android.article.base.app.setting;

import android.content.SharedPreferences;
import android.support.annotation.Keep;

import com.bytedance.article.common.setting.ISettings;
import com.bytedance.article.common.setting.SettingKey;
import com.ss.android.article.base.app.AppData;
import com.ss.android.common.util.ImmersedStatusBarHelper.IStatusBarConfig;

import org.json.JSONObject;

@Keep
public class AbSettings implements ISettings, IStatusBarConfig {
    protected boolean mFeedClearAllRefreshEnable;
    protected boolean mFeedClearRefreshEnable;
    protected boolean mFeedLoadMoreNewData;
    @SettingKey
    protected boolean mFeedPreDrawEnable;
    protected boolean mIsShowLastReadDocker;
    protected int mRefreshHistoryNotifyCount;
    @SettingKey
    protected int mRelatedNewsJumpToTT;
    protected boolean mSearchRecommendEnable;
    protected int mSearchRecommendNum;
    protected boolean mShowPlaceHolder;
    @SettingKey
    protected int mWebSearchEnable;
    @SettingKey
    int mApplogEvent;
    boolean mDetailAutoPlayNext;
    @SettingKey
    int mEnableArticleRecord;
    @SettingKey
    int mEnableLoginTipWhenFirstFavor;
    @SettingKey
    JSONObject mFeedRefreshSettingsJson;
    @SettingKey
    int mFeedShow;
    @SettingKey
    int mFixLoadMore;
    boolean mFullScreenAutoPlayNext;
    @SettingKey
    int mIsEnableImmeresedStatusBar;
    @SettingKey
    int mIsFeedBackWithVideoLog;
    @SettingKey
    int mIsGalleryFlat;
    @SettingKey
    int mIsLoadImage4G;
    @SettingKey
    int mIsShowWatermark;
    @SettingKey
    int mIsTitleBold;
    @SettingKey
    int mIsVideoDetailRelatedBackStackEnabled;
    @SettingKey
    int mIsVideoDiagnosisEnabled;
    @SettingKey
    int mIsVideoMultiResolutionEnabled;
    @SettingKey
    int mIsVideoRelatedButtonEnabled;
    @SettingKey
    int mLaunchOptFlag;
    @SettingKey
    int mLoadImageWhenFling;
    @SettingKey
    JSONObject mMainBackPressedRefreshSettings;
    @SettingKey
    int mOpenVideoCdnIpEnable;
    @SettingKey
    int mOpenVideoCdnStatistics;
    @SettingKey
    int mPersisitVivoMultiWindow;
    @SettingKey
    int mRefreshGuideInterval;
    @SettingKey
    int mSSLoadingViewStyle;
    @SettingKey
    JSONObject mSearchRecommendSettings;
    @SettingKey
    int mShareWay;
    int mSilenceInterval;
    @SettingKey
    JSONObject mSilenceRefreshSettings;
    @SettingKey
    int mSwipeBackEnabled;
    @SettingKey
    int mTcpReadTimeOut;
    @SettingKey
    int mUpdateJs;
    @SettingKey
    int mUserRefreshGuideType;
    @SettingKey
    String mVideoAutoPlay;
    int mVideoAutoPlayCount;
    JSONObject mVideoAutoPlayJSONObj;
    @SettingKey
    int mVideoFinishNewUI;
    @SettingKey
    int mVideoFixOnLineQuestionFlag;
    @SettingKey
    int mVideoUseIpUrl;
    @SettingKey
    int videoRecDetailAd;

    public AbSettings() {

        this.mVideoAutoPlayJSONObj = null;
        this.mDetailAutoPlayNext = false;
        this.mFullScreenAutoPlayNext = false;
        this.mVideoAutoPlayCount = -1;
        this.mFeedClearAllRefreshEnable = false;
        this.mFeedLoadMoreNewData = false;
        this.mFeedClearRefreshEnable = false;
        this.mIsShowLastReadDocker = true;
        this.mShowPlaceHolder = true;
        this.mSilenceInterval = 0;
    }

    public void afterLoadAppSetting() {
        this.parseFeedExperimentSetting();
        this.parseSearchRecommendSettings();
    }

    public void afterUpdateAppSetting() {
        this.parseFeedExperimentSetting();
        this.parseSearchRecommendSettings();
    }

    private void ensureVideoAutoPlayInited() {
        try {
            if (this.mVideoAutoPlayJSONObj != null) {
                return;
            }

            this.mVideoAutoPlayJSONObj = new JSONObject(this.mVideoAutoPlay);
            if (this.mVideoAutoPlayJSONObj.has("detail_auto_play_next")) {
                this.mDetailAutoPlayNext = this.mVideoAutoPlayJSONObj.getBoolean("detail_auto_play_next");
            }

            if (this.mVideoAutoPlayJSONObj.has("fullscreen_auto_play_next")) {
                this.mFullScreenAutoPlayNext = this.mVideoAutoPlayJSONObj.getBoolean("fullscreen_auto_play_next");
            }

            if (!this.mVideoAutoPlayJSONObj.has("video_auto_play_count")) {
                return;
            }

            this.mVideoAutoPlayCount = this.mVideoAutoPlayJSONObj.getInt("video_auto_play_count");
        } catch (Exception v0) {
        }
    }

    public int getApplogEvent() {
        return this.mApplogEvent;
    }

    public int getBackPressedRefreshInterval() {
        int v0 = 2000;
        if (this.mMainBackPressedRefreshSettings != null) {
            v0 = this.mMainBackPressedRefreshSettings.optInt("back_pressed_interval", v0);
        }

        return v0;
    }

    public int getRefreshGuideInterval() {
        return this.mRefreshGuideInterval;
    }

    public int getRefreshHistoryNotifyCount() {
        return this.mRefreshHistoryNotifyCount;
    }

    public int getSearchRecommendNum() {
        int v0 = android.support.design.a.isTest() ? AppData.getInstance().mSearchRecommendTextCount : this.mSearchRecommendNum;
        return v0;
    }

    public int getShareWay() {
        return this.mShareWay;
    }

    public int getSilenceInterval() {
        if (this.mSilenceRefreshSettings != null) {
            this.mSilenceInterval = this.mSilenceRefreshSettings.optInt("tt_lite_silence_interval", 0);
        }

        return this.mSilenceInterval;
    }

    public int getTcpReadTimeOut() {
        return this.mTcpReadTimeOut;
    }

    public int getUserRefreshGuideType() {
        return this.mUserRefreshGuideType;
    }

    public int getVideoAutoPlayCount() {
        this.ensureVideoAutoPlayInited();
        return this.mVideoAutoPlayCount;
    }

    public int getVideoFixONLineQuestionFlage() {
        return this.mVideoFixOnLineQuestionFlag;
    }

    public boolean isAppLogNew() {
        return true;
    }

    public boolean isAppLogOld() {
        return false;
    }

    public boolean isApplogStaging() {
        return false;
    }

    public boolean isBackPressedIntervalStrategy() {
        boolean v0 = true;
        if (this.mMainBackPressedRefreshSettings != null) {
            if ((this.isBackPressedRefreshEnable()) && this.mMainBackPressedRefreshSettings.optInt("back_pressed_strategy", 1) == 1) {
                return v0;
            }

            v0 = false;
        } else {
            v0 = false;
        }

        return v0;
    }

    public boolean isBackPressedMoveStrategy() {
        boolean v0 = true;
        if (this.mMainBackPressedRefreshSettings != null) {
            if ((this.isBackPressedRefreshEnable()) && this.mMainBackPressedRefreshSettings.optInt("back_pressed_strategy", 1) != 1) {
                return v0;
            }

            v0 = false;
        } else {
            v0 = false;
        }

        return v0;
    }

    public boolean isBackPressedRefreshEnable() {
        boolean v0 = !this.isBackPressedRefreshEnableFromServer() || !AppData.getInstance().mBackRefresh ? false : true;
        return v0;
    }

    public boolean isBackPressedRefreshEnableFromServer() {
        boolean v0 = false;
        if (this.mMainBackPressedRefreshSettings != null && this.mMainBackPressedRefreshSettings.optInt("is_enable") != 0) {
            v0 = true;
        }

        return v0;
    }

    public boolean isBackRefreshInCategoryAll() {
        boolean v0 = false;
        if (this.mMainBackPressedRefreshSettings != null && this.mMainBackPressedRefreshSettings.optInt("back_pressed_category_all") != 0) {
            v0 = true;
        }

        return v0;
    }

    public boolean isBottomShare() {
        boolean v0 = (this.mShareWay & 2) == 2 ? true : false;
        return v0;
    }

    public boolean isDetailAutoPlayNext() {
        this.ensureVideoAutoPlayInited();
        return this.mDetailAutoPlayNext;
    }

    public boolean isEnableArticleRecord() {
        boolean v0 = this.mEnableArticleRecord != 0 ? true : false;
        return v0;
    }

    public boolean isEnableFeedBackWithVideoLog() {
        boolean v0 = this.mIsFeedBackWithVideoLog > 0 ? true : false;
        return v0;
    }

    public boolean isEnableImmersedStatusBar() {
        boolean v0 = this.mIsEnableImmeresedStatusBar > 0 ? true : false;
        return v0;
    }

    public boolean isFeedClearAllRefreshEnable() {
        return this.mFeedClearAllRefreshEnable;
    }

    public boolean isFeedClearRefreshEnable() {
        return this.mFeedClearRefreshEnable;
    }

    public boolean isFeedLoadMoreNewData() {
        return this.mFeedLoadMoreNewData;
    }

    public boolean isFeedPreDrawEnable() {
        return this.mFeedPreDrawEnable;
    }

    public boolean isFeedShowLastReadDocker() {
        return this.mIsShowLastReadDocker;
    }

    public boolean isFixLoadMore() {
        boolean v0 = true;
        if (this.mFixLoadMore != 1) {
            v0 = false;
        }

        return v0;
    }

    public boolean isFullScreenAutoPlayNext() {
        this.ensureVideoAutoPlayInited();
        return this.mFullScreenAutoPlayNext;
    }

    public boolean isGalleryFlat() {
        boolean v0 = this.mIsGalleryFlat != 0 ? true : false;
        return v0;
    }

    public boolean isLoadImage4G() {
        return true;
    }

    public boolean isNormalShare() {
        boolean v0 = this.mShareWay == 0 ? true : false;
        return v0;
    }

    public boolean isOpenVideoCdnStatistics() {
        boolean v0 = this.mOpenVideoCdnStatistics != 0 ? true : false;
        return v0;
    }

    public boolean isOpenVideoIpEnable() {
        boolean v0 = this.mOpenVideoCdnIpEnable != 0 ? true : false;
        return v0;
    }

    public boolean isPersistVivoMultiWindow() {
        boolean v0 = this.mPersisitVivoMultiWindow != 0 ? true : false;
        return v0;
    }

    public boolean isQQTopShare() {
        boolean v0 = (this.mShareWay & 32) == 32 ? true : false;
        return v0;
    }

    public boolean isRelatedNewsJumpToTT() {
        boolean v0 = this.mRelatedNewsJumpToTT > 0 ? true : false;
        return v0;
    }

    public boolean isSSLoadingViewNewStyle() {
        boolean v0 = true;
        if (this.mSSLoadingViewStyle != 1) {
            v0 = false;
        }

        return v0;
    }

    public boolean isSearchRecommendEnable() {
        boolean v0 = android.support.design.a.isTest() ? AppData.getInstance().mSearchRecommend : this.mSearchRecommendEnable;
        return v0;
    }

    public boolean isShowMainWebsiteFragment() {
        boolean v0 = this.mFeedShow == 0 ? true : false;
        return v0;
    }

    public boolean isShowPlaceHolder() {
        return this.mShowPlaceHolder;
    }

    public boolean isShowWaterMark() {
        boolean v0 = true;
        if (this.mIsShowWatermark != 1) {
            v0 = false;
        }

        return v0;
    }

    public boolean isSilenceRefreshOpen() {
        boolean v0 = true;
        if (this.mSilenceRefreshSettings == null) {
            v0 = false;
        } else if (this.mSilenceRefreshSettings.optInt("tt_lite_silence_refresh_open", 0) != 1) {
            v0 = false;
        }

        return v0;
    }

    public boolean isSwipeBackEnabled() {
        boolean v0 = true;
        if (this.mSwipeBackEnabled != 1) {
            v0 = false;
        }

        return v0;
    }

    public boolean isTitleBold() {
        boolean v0 = this.mIsTitleBold > 0 ? true : false;
        return v0;
    }

    public boolean isTopShare() {
        boolean v0 = true;
        if ((this.mShareWay & 1) != 1) {
            v0 = false;
        }

        return v0;
    }

    public boolean isUpdateJs() {
        boolean v0 = this.mUpdateJs == 0 ? true : false;
        return v0;
    }

    public boolean isUseVideoFinishNewUI() {
        boolean v0 = this.mVideoFinishNewUI != 0 ? true : false;
        return v0;
    }

    public boolean isVideoDetailRelatedBackStackEnabled() {
        boolean v0 = this.mIsVideoDetailRelatedBackStackEnabled > 0 ? true : false;
        return v0;
    }

    public boolean isVideoDetailRelatedButtonEnabled() {
        boolean v0 = this.mIsVideoRelatedButtonEnabled > 0 ? true : false;
        return v0;
    }

    public boolean isVideoDiagnosisEnabled() {
        boolean v0 = this.mIsVideoDiagnosisEnabled > 0 ? true : false;
        return v0;
    }

    public boolean isVideoFragmentShare() {
        boolean v0 = (this.mShareWay & 16) == 16 ? true : false;
        return v0;
    }

    public boolean isVideoListShare() {
        boolean v0 = (this.mShareWay & 4) == 4 ? true : false;
        return v0;
    }

    public boolean isVideoMultiResolutionEnabled() {
        boolean v0 = this.mIsVideoMultiResolutionEnabled > 0 ? true : false;
        return v0;
    }

    public boolean isVideoPlayerShare() {
        boolean v0 = (this.mShareWay & 8) == 8 ? true : false;
        return v0;
    }

    public boolean isVideoUseIpUrl() {
        boolean v0 = this.mVideoUseIpUrl != 0 ? true : false;
        return v0;
    }

    public boolean isWebSearchEnable() {
        boolean v0 = true;
        if (android.support.design.a.isTest()) {
            v0 = AppData.getInstance().mSearchRecommendCount;
        } else if (this.mWebSearchEnable != 1) {
            v0 = false;
        }

        return v0;
    }

    public void loadData(SharedPreferences arg1) {
    }

    private void parseFeedExperimentSetting() {
        boolean v1 = true;
        if (this.mFeedRefreshSettingsJson != null) {
            boolean v0 = this.mFeedRefreshSettingsJson.optInt("load_more_new_data", 0) == 1 ? true : false;
            this.mFeedLoadMoreNewData = v0;
            v0 = this.mFeedRefreshSettingsJson.optInt("refresh_clear_enable", 0) == 1 ? true : false;
            this.mFeedClearRefreshEnable = v0;
            v0 = this.mFeedRefreshSettingsJson.optInt("is_show_last_read_docker", 1) == 1 ? true : false;
            this.mIsShowLastReadDocker = v0;
            v0 = this.mFeedRefreshSettingsJson.optInt("refresh_clear_all_enable", 0) == 1 ? true : false;
            this.mFeedClearAllRefreshEnable = v0;
            this.mRefreshHistoryNotifyCount = this.mFeedRefreshSettingsJson.optInt("refresh_history_notify_count", 0);
            if (this.mFeedRefreshSettingsJson.optInt("is_place_holder_show", 0) != 1) {
                v1 = false;
            }

            this.mShowPlaceHolder = v1;
        }
    }

    private void parseSearchRecommendSettings() {
        if (this.mSearchRecommendSettings != null) {
            this.mSearchRecommendEnable = this.mSearchRecommendSettings.optBoolean("search_recommend_enable", false);
            this.mSearchRecommendNum = this.mSearchRecommendSettings.optInt("search_recommend_text_count", 1);
        }
    }

    public void saveData(SharedPreferences.Editor arg1) {
    }

    public boolean shouldLoadImageWhenFling() {
        boolean v0 = this.mLoadImageWhenFling != 0 ? true : false;
        return v0;
    }

    public boolean shouldShowLoginTipWhenFirstFavor() {
        boolean v0 = true;
        if (this.mEnableLoginTipWhenFirstFavor != 1) {
            v0 = false;
        }

        return v0;
    }

    public boolean tryUpdateAppSetting(JSONObject arg2) {
        return false;
    }

    public boolean videoRecForDetailAd() {
        return this.videoRecDetailAd > 0;
    }
}

